package pdsgameserver;
import java.io.Serializable;
import com.sun.sgs.app.ManagedObject;
import com.sun.sgs.app.AppContext;
import com.sun.sgs.app.Channel;
import com.sun.sgs.app.ChannelManager;

public class ChatGame extends Game implements Serializable, ManagedObject
{
	/** The version of the serialized form of this class. */
    private static final long serialVersionUID = 4L;
    
	public ChatGame(String name)
	{
		super.setName(name);
	}
	
	public void move(Player p, String move) {}
	
	public boolean join(Player p)
	{
		ChannelManager channelMgr = AppContext.getChannelManager();
		Channel chan = channelMgr.getChannel(gameName);	
		chan.join(p.getSession(), null);
		return true;
	}
	
	public void leave(Player p)
	{
		ChannelManager channelMgr = AppContext.getChannelManager();
		Channel chan = channelMgr.getChannel(gameName);	
		chan.leave(p.getSession());
	}
	
}
